using Chaotic.DataBase.DataAccess;
using Chaotic.DataBase.DBAccessLibrary.Common;

namespace Chaotic.DataBase.DBAccessLibrary.Model;

[Serializable]
public class ConnectionModel : BaseConnection
{
	private string? _server;

	private string? _database;

	private string _userid;

	private string _password;

	private DatabaseType _type;

	public string? Server
	{
		get => _server;
        set
		{
			_server = value;
			this.NotifyPropertyChanged(o => o.Server);
		}
	}

	public string? DataBase
	{
		get => _database;
        set
		{
			_database = value;
			this.NotifyPropertyChanged(o => o.DataBase);
		}
	}

	public string UserID
	{
		get => _userid;
        set
		{
			_userid = value;
			this.NotifyPropertyChanged(o => o.UserID);
		}
	}

	public string PassWord
	{
		get => _password;
        set
		{
			_password = value;
			this.NotifyPropertyChanged(o => o.PassWord);
		}
	}

	public DatabaseType ConnectType
	{
		get => _type;
        set
		{
			_type = value;
			this.NotifyPropertyChanged(o => o.ConnectType);
		}
	}

	public bool Compare(ConnectionModel model)
	{
		if (_database == model.DataBase && _password == model.PassWord && _server == model.Server && _type == model.ConnectType && _userid == model.UserID)
		{
			return true;
		}
		return false;
	}
}
